package com.example.source.spring.transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/trans")
public class Controller {
    @Autowired
    TransactionalService service;

    @RequestMapping("get")
    public List<Person> get() {
        List<Person> people = service.get();
        System.out.println(people.toString());
        return people;
    }

    @RequestMapping("add")
    public int add(Person person) {
        return service.add(person);
    }
}
